package com.x.erp.dao;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.x.erp.model.ModelConf;
import com.x.framework.dao.BaseDao;

/**
 * 车型配置DAO
 */
@Repository
public class ModelConfDao extends BaseDao {

	private final static String selectModelConfByIdSql = "SELECT bmc.* FROM x_base.BASE_MODEL_CONF bmc WHERE true ";

	/**
	 * 查询车型配置
	 * @param modelConf
	 * @return
	 */
	public List<ModelConf> selectModelConfList(ModelConf modelConf) throws Exception {
		StringBuilder sql = new StringBuilder(selectModelConfByIdSql);
		List<Object> params = new ArrayList<Object>();
		if(modelConf.getModelId() != null) {
			sql.append("AND bmc.MODEL_ID = ? ");
			params.add(modelConf.getModelId());
		}
		return this.queryForList(sql.toString(), ModelConf.class, params);
	}

}
